import { BasicColumn, FormSchema } from '/@/components/Table';
import dayjs from 'dayjs';
import lodash from 'lodash';
import { h } from 'vue';
import { Tag } from 'ant-design-vue';
import { render } from '/@/utils/common/renderUtils';

export const columns: BasicColumn[] = [
  {
    title: '用户编号',
    align: 'center',
    dataIndex: 'id',
    customRender: ({ text }) => render.renderHtml(text),
  },
  {
    title: '账号',
    align: 'center',
    dataIndex: 'username',
    customRender: ({ text }) => render.renderHtml(text),
  },
  {
    title: '用户名',
    align: 'center',
    dataIndex: 'nickname',
    customRender: ({ text }) => render.renderHtml(text),
  },
  {
    title: '手机号',
    align: 'center',
    dataIndex: 'mobile',
    customRender: ({ text }) => render.renderHtml(text),
  },
  {
    title: '性别',
    align: 'center',
    dataIndex: 'sex',
  },
  {
    title: '用户类别',
    align: 'center',
    dataIndex: 'type',
    customRender: ({ text }) => render.renderHtml(text),
  },
  {
    title: '创建时间',
    align: 'center',
    dataIndex: 'createTime',
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'queryField',
    component: 'Select',
    label: '查询类型',
    defaultValue: '_all',
    componentProps: {
      options: [
        { value: '_all', label: '全文搜索' },
        { value: '_id', label: 'ID' },
        { value: 'username', label: '账号' },
        { value: 'nickname', label: '用户名' },
        { value: 'mobile', label: '手机号' },
        { value: 'type', label: '用户类别' },
      ],
    },
    colProps: {
      span: 6,
    },
  },
  {
    field: 'queryValue',
    label: '查询类型值',
    component: 'Input',
    colProps: { span: 6 },
  },
];
